/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainFrame.java
 *
 * Created on Jul 15, 2010, 10:25:31 PM
 */
package GUI;

/**
 *
 * @author MinhHieu
 */
public class MainFrame extends javax.swing.JFrame {

    /** Creates new form MainFrame */
    public MainFrame() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktopPane = new javax.swing.JDesktopPane();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jToolBar1 = new javax.swing.JToolBar();
        jLTrangThai = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMHeThong = new javax.swing.JMenu();
        jMIDangNhap = new javax.swing.JMenuItem();
        jMIDangXuat = new javax.swing.JMenuItem();
        jMIQLNguoiDung = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        jMIQLNamHoc = new javax.swing.JMenuItem();
        jMIQLLop = new javax.swing.JMenuItem();
        jMIQLHocSinh = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        jMIQLMonHoc = new javax.swing.JMenuItem();
        jMIQLQuyDinh = new javax.swing.JMenuItem();
        jMDanhSach = new javax.swing.JMenu();
        jMIDSHocSinh = new javax.swing.JMenuItem();
        jMQuanLy = new javax.swing.JMenu();
        jMIXepLop = new javax.swing.JMenuItem();
        jMINhapDiem = new javax.swing.JMenuItem();
        jMBaoCao = new javax.swing.JMenu();
        jMIBCMon = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("CHƯƠNG TRÌNH QUẢN LÝ HỌC SINH");

        jDesktopPane.setBackground(new java.awt.Color(51, 153, 255));

        jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 30));
        jLabel1.setForeground(new java.awt.Color(0, 0, 255));
        jLabel1.setText("Đồ án tốt nghiệp JAVA");
        jLabel1.setBounds(20, 20, 310, 40);
        jDesktopPane.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 36));
        jLabel2.setForeground(new java.awt.Color(255, 255, 51));
        jLabel2.setText("QUẢN LÝ HỌC SINH");
        jLabel2.setBounds(20, 60, 370, 60);
        jDesktopPane.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel3.setForeground(new java.awt.Color(0, 0, 51));
        jLabel3.setText("Giáo viên hướng dẫn:");
        jLabel3.setBounds(20, 140, 140, 20);
        jDesktopPane.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel4.setText("Thầy Nguyễn Hoàng Anh");
        jLabel4.setBounds(160, 140, 170, 20);
        jDesktopPane.add(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel5.setText("Cô Trần Phương Thảo");
        jLabel5.setBounds(160, 170, 140, -1);
        jDesktopPane.add(jLabel5, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel6.setForeground(new java.awt.Color(0, 0, 51));
        jLabel6.setText("Thực hiện:");
        jLabel6.setBounds(20, 220, 70, 20);
        jDesktopPane.add(jLabel6, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel7.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel7.setText("Ngô Huy Đạt");
        jLabel7.setBounds(100, 220, 80, 20);
        jDesktopPane.add(jLabel7, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel8.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel8.setText("Nguyễn Minh Hiếu");
        jLabel8.setBounds(100, 250, 140, -1);
        jDesktopPane.add(jLabel8, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel9.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel9.setText("Copyright ©2010 - Group 12™");
        jLabel9.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jLabel9.setBounds(10, 300, -1, -1);
        jDesktopPane.add(jLabel9, javax.swing.JLayeredPane.DEFAULT_LAYER);

        getContentPane().add(jDesktopPane, java.awt.BorderLayout.CENTER);

        jToolBar1.setBorderPainted(false);
        jToolBar1.setEnabled(false);
        jToolBar1.setPreferredSize(new java.awt.Dimension(13, 22));

        jLTrangThai.setText("Bạn chưa đăng nhập");
        jToolBar1.add(jLTrangThai);

        getContentPane().add(jToolBar1, java.awt.BorderLayout.PAGE_END);

        jMHeThong.setText("Hệ thống");

        jMIDangNhap.setText("Đăng nhập");
        jMIDangNhap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMIDangNhapActionPerformed(evt);
            }
        });
        jMHeThong.add(jMIDangNhap);

        jMIDangXuat.setText("Đăng xuất");
        jMIDangXuat.setEnabled(false);
        jMIDangXuat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMIDangXuatActionPerformed(evt);
            }
        });
        jMHeThong.add(jMIDangXuat);

        jMIQLNguoiDung.setText("Quản lý người dùng");
        jMIQLNguoiDung.setEnabled(false);
        jMIQLNguoiDung.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMIQLNguoiDungActionPerformed(evt);
            }
        });
        jMHeThong.add(jMIQLNguoiDung);
        jMHeThong.add(jSeparator1);

        jMIQLNamHoc.setText("1.Nhập năm học mới");
        jMIQLNamHoc.setEnabled(false);
        jMIQLNamHoc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMIQLNamHocActionPerformed(evt);
            }
        });
        jMHeThong.add(jMIQLNamHoc);

        jMIQLLop.setText("2.Mở lớp mới");
        jMIQLLop.setEnabled(false);
        jMIQLLop.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMIQLLopActionPerformed(evt);
            }
        });
        jMHeThong.add(jMIQLLop);

        jMIQLHocSinh.setText("3.Tiếp nhận học Sinh");
        jMIQLHocSinh.setEnabled(false);
        jMIQLHocSinh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMIQLHocSinhActionPerformed(evt);
            }
        });
        jMHeThong.add(jMIQLHocSinh);
        jMHeThong.add(jSeparator2);

        jMIQLMonHoc.setText("Quản lý các môn học");
        jMIQLMonHoc.setEnabled(false);
        jMIQLMonHoc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMIQLMonHocActionPerformed(evt);
            }
        });
        jMHeThong.add(jMIQLMonHoc);

        jMIQLQuyDinh.setText("Thay đổi quy định");
        jMIQLQuyDinh.setEnabled(false);
        jMIQLQuyDinh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMIQLQuyDinhActionPerformed(evt);
            }
        });
        jMHeThong.add(jMIQLQuyDinh);

        jMenuBar1.add(jMHeThong);

        jMDanhSach.setText("Danh sách");

        jMIDSHocSinh.setText("Học sinh");
        jMIDSHocSinh.setEnabled(false);
        jMIDSHocSinh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMIDSHocSinhActionPerformed(evt);
            }
        });
        jMDanhSach.add(jMIDSHocSinh);

        jMenuBar1.add(jMDanhSach);

        jMQuanLy.setText("Quản lý");

        jMIXepLop.setText("Lập danh sách lớp");
        jMIXepLop.setEnabled(false);
        jMIXepLop.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMIXepLopActionPerformed(evt);
            }
        });
        jMQuanLy.add(jMIXepLop);

        jMINhapDiem.setText("Nhập bảng điểm");
        jMINhapDiem.setEnabled(false);
        jMINhapDiem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMINhapDiemActionPerformed(evt);
            }
        });
        jMQuanLy.add(jMINhapDiem);

        jMenuBar1.add(jMQuanLy);

        jMBaoCao.setText("Báo cáo");

        jMIBCMon.setText("Tổng kết môn học");
        jMIBCMon.setEnabled(false);
        jMIBCMon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMIBCMonActionPerformed(evt);
            }
        });
        jMBaoCao.add(jMIBCMon);

        jMenuBar1.add(jMBaoCao);

        jMenu1.setText("Tìm kiếm");

        jMenuItem1.setText("Học sinh");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem1);

        jMenuBar1.add(jMenu1);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMIQLHocSinhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIQLHocSinhActionPerformed
        // TODO add your handling code here:
        HocSinhInternalFrame themhs = new HocSinhInternalFrame();
        themhs.setVisible(true);
        this.jDesktopPane.add(themhs);
    }//GEN-LAST:event_jMIQLHocSinhActionPerformed

    private void jMIXepLopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIXepLopActionPerformed
        // TODO add your handling code here:
        XepLopInternalFrame frm = new XepLopInternalFrame();
        frm.setVisible(true);
        this.jDesktopPane.add(frm, 0);
    }//GEN-LAST:event_jMIXepLopActionPerformed

    private void jMIQLLopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIQLLopActionPerformed
        // TODO add your handling code here:
        LopInternalFrame l = new LopInternalFrame();
        l.setVisible(true);
        this.jDesktopPane.add(l, 0);
    }//GEN-LAST:event_jMIQLLopActionPerformed

    private void jMIQLNamHocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIQLNamHocActionPerformed
        // TODO add your handling code here:
        NamHocInternalFrame frm = new NamHocInternalFrame();
        frm.setVisible(true);
        this.jDesktopPane.add(frm, 0);
    }//GEN-LAST:event_jMIQLNamHocActionPerformed

    private void jMIQLMonHocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIQLMonHocActionPerformed
        // TODO add your handling code here:
        MonHocInternalFrame frm = new MonHocInternalFrame();
        frm.setVisible(true);
        this.jDesktopPane.add(frm, 0);
    }//GEN-LAST:event_jMIQLMonHocActionPerformed

    private void jMIBCMonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIBCMonActionPerformed
        // TODO add your handling code here:
        BaoCaoTongKetInternalFrame frm = new BaoCaoTongKetInternalFrame();
        frm.setVisible(true);
        this.jDesktopPane.add(frm, 0);
    }//GEN-LAST:event_jMIBCMonActionPerformed

    private void jMIDSHocSinhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIDSHocSinhActionPerformed
        // TODO add your handling code here:
        DanhSachHocSinhInternalFrame frm = new DanhSachHocSinhInternalFrame();
        frm.setVisible(true);
        this.jDesktopPane.add(frm, 0);
    }//GEN-LAST:event_jMIDSHocSinhActionPerformed

    private void jMIDangNhapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIDangNhapActionPerformed
        // TODO add your handling code here:
        DangNhapDialog dialog = new DangNhapDialog(this, true);
        dialog.setVisible(true);
        if(dialog.getKQDangNhap()==true){
            this.jMIDangNhap.setEnabled(false);
            this.jMIDangXuat.setEnabled(true);
            if(dialog.getNguoiDung().getTaiKhoan().equals("admin")){
                this.jMIQLNguoiDung.setEnabled(true);
            }
            
            this.jMIQLNamHoc.setEnabled(dialog.getNguoiDung().isQLNamHoc());
            this.jMIQLLop.setEnabled(dialog.getNguoiDung().isQLLop());
            this.jMIQLHocSinh.setEnabled(dialog.getNguoiDung().isQLHocSinh());
            this.jMIQLMonHoc.setEnabled(dialog.getNguoiDung().isQLMonHoc());
            this.jMIQLQuyDinh.setEnabled(dialog.getNguoiDung().isQLQuyDinh());
            this.jMIDSHocSinh.setEnabled(dialog.getNguoiDung().isDSHocSinh());
            this.jMIXepLop.setEnabled(dialog.getNguoiDung().isXepLop());
            this.jMINhapDiem.setEnabled(dialog.getNguoiDung().isNhapDiem());
            this.jMIBCMon.setEnabled(dialog.getNguoiDung().isBCMon());

            this.jLTrangThai.setText("Bạn đang đăng nhập với quyền "+dialog.getNguoiDung().getTenNguoiDung());
        }
    }//GEN-LAST:event_jMIDangNhapActionPerformed

    private void jMIQLQuyDinhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIQLQuyDinhActionPerformed
        // TODO add your handling code here:
        QuyDinhInternalFrame frm = new QuyDinhInternalFrame();
        frm.setVisible(true);
        this.jDesktopPane.add(frm, 0);
    }//GEN-LAST:event_jMIQLQuyDinhActionPerformed

    private void jMINhapDiemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMINhapDiemActionPerformed
        // TODO add your handling code here:
        NhapDiemHTFrame frm = new NhapDiemHTFrame();
        frm.setVisible(true);
        this.jDesktopPane.add(frm, 0);
    }//GEN-LAST:event_jMINhapDiemActionPerformed

    private void jMIDangXuatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIDangXuatActionPerformed
        // TODO add your handling code here:
        this.jMIDangNhap.setEnabled(true);
        this.jMIDangXuat.setEnabled(false);
        this.jMIQLNguoiDung.setEnabled(false);

        this.jMIQLNamHoc.setEnabled(false);
        this.jMIQLLop.setEnabled(false);
        this.jMIQLHocSinh.setEnabled(false);
        this.jMIQLMonHoc.setEnabled(false);
        this.jMIQLQuyDinh.setEnabled(false);
        this.jMIDSHocSinh.setEnabled(false);
        this.jMIXepLop.setEnabled(false);
        this.jMINhapDiem.setEnabled(false);
        this.jMIBCMon.setEnabled(false);
        for(int i=0;i<this.jDesktopPane.getAllFrames().length;i++){
            this.jDesktopPane.getAllFrames()[i].setVisible(false);
        }
        this.jLTrangThai.setText("Bạn chưa đăng nhập");
    }//GEN-LAST:event_jMIDangXuatActionPerformed

    private void jMIQLNguoiDungActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIQLNguoiDungActionPerformed
        // TODO add your handling code here:
        NguoiDungInternalFrame frm = new NguoiDungInternalFrame();
        frm.setVisible(true);
        this.jDesktopPane.add(frm, 0);
    }//GEN-LAST:event_jMIQLNguoiDungActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        TimKiemHSJInternalFrame frm = new TimKiemHSJInternalFrame();
        frm.setVisible(true);
        this.jDesktopPane.add(frm, 0);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MainFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane jDesktopPane;
    private javax.swing.JLabel jLTrangThai;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMBaoCao;
    private javax.swing.JMenu jMDanhSach;
    private javax.swing.JMenu jMHeThong;
    private javax.swing.JMenuItem jMIBCMon;
    private javax.swing.JMenuItem jMIDSHocSinh;
    private javax.swing.JMenuItem jMIDangNhap;
    private javax.swing.JMenuItem jMIDangXuat;
    private javax.swing.JMenuItem jMINhapDiem;
    private javax.swing.JMenuItem jMIQLHocSinh;
    private javax.swing.JMenuItem jMIQLLop;
    private javax.swing.JMenuItem jMIQLMonHoc;
    private javax.swing.JMenuItem jMIQLNamHoc;
    private javax.swing.JMenuItem jMIQLNguoiDung;
    private javax.swing.JMenuItem jMIQLQuyDinh;
    private javax.swing.JMenuItem jMIXepLop;
    private javax.swing.JMenu jMQuanLy;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JToolBar jToolBar1;
    // End of variables declaration//GEN-END:variables
}
